/* GUI CONVERTED from pppirp01.p (converter v1.75) Sun Aug 13 13:46:08 2000 */
/* pppirp01.p - PRICE LIST REPORT                                             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*F0PN*/ /*K0V6*/
/*V8:ConvertMode=FullGUIReport                                                */
/* REVISION: 8.5      LAST MODIFIED: 02/17/95   BY: nte *J042*                */
/* REVISION: 8.5      LAST MODIFIED: 09/01/95   BY: DAH *J07H*                */
/* REVISION: 8.5      LAST MODIFIED: 06/19/96   BY: jpm *J0VJ*                */
/* REVISION: 8.5      LAST MODIFIED: 07/30/97   BY: *J1XZ* Aruna Patil        */
/* REVISION: 8.6      LAST MODIFIED: 10/13/97   BY: mzv *K0V6*                */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 10/01/99   BY: *N014* Robin McCarthy     */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 07/19/00   BY: *N0GF* Mudit Mehta        */
/* REVISION: 9.1      LAST MODIFIED: 08/13/00   BY: *N0KQ* myb                */

     /* DISPLAY TITLE */

/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

     {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

/*N014*  &SCOPED-DEFINE pppirp01_p_1 "Project!Accrual Proj" */
/*N014*  /* MaxLen: Comment: */ */
/*N014*/ &SCOPED-DEFINE pppirp01_p_1 "Project!Project"
/*N014*/ /* MaxLen: 8  Comment: */

/*N0GF*
 *       &SCOPED-DEFINE pppirp01_p_2 "/Analysis Code"
 *       /* MaxLen: Comment: */
 *N0GF*/

         &SCOPED-DEFINE pppirp01_p_3 "Max Orders!Disc Sequence"
         /* MaxLen: Comment: */

         &SCOPED-DEFINE pppirp01_p_4 "Comb Type!Qty Type"
         /* MaxLen: Comment: */

         &SCOPED-DEFINE pppirp01_p_5 "Min Net Ord!Max Qty"
         /* MaxLen: Comment: */

         &SCOPED-DEFINE pppirp01_p_6 "Config!Manual"
         /* MaxLen: Comment: */

         &SCOPED-DEFINE pppirp01_p_7 "Break Cat"
         /* MaxLen: Comment: */

/*N014*  &SCOPED-DEFINE pppirp01_p_8 "Cost Ctr!Accrual CC" */
/*N014*  /* MaxLen: Comment: */ */
/*N014*/ &SCOPED-DEFINE pppirp01_p_8 "Cost Ctr!Cost Ctr"
/*N014*/ /* MaxLen: 8 Comment: Cost Center */

         &SCOPED-DEFINE pppirp01_p_9 "Disc Acct!Accrual Acct"
         /* MaxLen: Comment: */

         &SCOPED-DEFINE pppirp01_p_10 "Cost Set!Print"
         /* MaxLen: Comment: */

         &SCOPED-DEFINE pppirp01_p_11 "Effective"
         /* MaxLen: Comment: */

/*N014*/ &SCOPED-DEFINE pppirp01_p_12 "Sub-Acct!Sub-Acct"
/*N014*/ /* MaxLen: 8  Comment: Sub-Account */

/* ********** End Translatable Strings Definitions ********* */


         define            variable plist          like pi_list.
         define            variable plist1         like pi_list.
         define            variable pics_type      like pi_cs_type
               format "x(25)".
         define            variable pics_code      like pi_cs_code.
         define            variable pics_code1     like pi_cs_code.
         define            variable part_type      like pi_part_type
               format "x(25)".
         define            variable part_code      like pi_part_code.
         define            variable part_code1     like pi_part_code.
         define            variable curr           like pi_curr.
         define            variable curr1          like pi_curr.
         define            variable effective      like pi_start
               label {&pppirp01_p_11}.
         define            variable all_token      like an_code
                           initial
                           "qadall--+--+--+--+--+".
         define            variable amt_type       like pi_amt_type.
         define            variable comb_type      like pi_comb_type.
         define            variable pics_type_key  like lngd_key1.
         define new shared variable cmtindx        like cmt_indx.
         define new shared variable part_frame_row as integer.
         define new shared variable pirecno        as recid.
         define            variable part_type_key  like lngd_key1.
         define            variable qty_type       like pi_qty_type.
         define            variable tmp_type       like cs_type.


         /*===form definition===============================================*/

         /* DISPLAY SELECTION FORM */
         
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
            
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
plist            colon 25
            plist1           label {t001.i} colon 50
/*J0VJ*/ /* pics_type        to 25  no-label */
/*J0VJ*/ /* pics_code               no-label */
/*J0VJ*/    pics_code        colon 25
            pics_code1       label {t001.i} colon 50
/*J0VJ*/ /* part_type        to 25 no-label */
/*J0VJ*/ /* part_code              no-label */
/*J0VJ*/    part_code        colon 25
            part_code1       label {t001.i} colon 50
            curr             colon 25
            curr1            label {t001.i} colon 50
            effective        colon 25
            skip(1)
          SKIP(.4)  /*GUI*/
with frame a width 80 side-labels no-attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



         /* SET EXTERNAL LABELS */
         setFrameLabels(frame a:handle).


         FORM /*GUI*/ 
            pi_list
            pi_desc
            pi_cs_code
            pi_part_code
            pi_curr
            pi_um
            pi_start
            pi_expire
            amt_type
         with STREAM-IO /*GUI*/  frame b width 132 no-attr-space.

         /* SET EXTERNAL LABELS */
         setFrameLabels(frame b:handle).

         FORM /*GUI*/ 
            comb_type format "x(14)" colon 5
              column-label {&pppirp01_p_4}
            pi_min_net format "->,>>>,>>9.99"
              column-label {&pppirp01_p_5}
            pi_break_cat   column-label {&pppirp01_p_7}
            pi_confg_disc  column-label {&pppirp01_p_6}
            pi_cost_set    column-label {&pppirp01_p_10}
/*J1XZ**    pi_max_ord    column-label "Max Orders!Disc Sequence"  */
/*J1XZ*/    pi_disc_seq   column-label {&pppirp01_p_3}
            pi_disc_acct  column-label {&pppirp01_p_9}
/*N014*/    pi_disc_sub   column-label {&pppirp01_p_12}
            pi_disc_cc    column-label {&pppirp01_p_8}
            pi_disc_proj  column-label {&pppirp01_p_1}
         with STREAM-IO /*GUI*/  frame c width 132 no-attr-space.

         /* SET EXTERNAL LABELS */
         setFrameLabels(frame c:handle).

         /*===initialization================================================*/

         /* Set default types */
         /* (Eventually, one or both of these fields might become     */
         /* user accessble; for now we only allow customer and item). */
         pics_type_key = "9".  /* customer */
         find first lngd_det where lngd_dataset = "an_mstr"
                       and lngd_field   = "an_type"
                       and lngd_lang    = global_user_lang
                       and lngd_key1    = pics_type_key
                     no-lock.
         /* The string in the next line should match the label for an_code */
/*J0VJ*/ /* tmp_type = lngd_translation + " Code".     */
/*N0GF* /*J0VJ*/ tmp_type = lngd_translation + {&pppirp01_p_2}. */
/*N0GF*/ tmp_type = lngd_translation + "/" + getTermLabel("ANALYSIS_CODE",13).

         substring(pics_type, 25 - length(tmp_type), length(tmp_type)) =
            tmp_type.
/*J0VJ*/ /* substring(pics_type, 25, 1) = ":". */
/*J0VJ*/ pics_code:label in frame a = trim(pics_type).

         part_type_key = "6".  /* item */
         find first lngd_det where lngd_dataset = "an_mstr"
                       and lngd_field   = "an_type"
                       and lngd_lang    = global_user_lang
                       and lngd_key1    = part_type_key
                     no-lock.
         /* The string in the next line should match the label for an_code */
/*J0VJ*/ /* tmp_type = lngd_translation + " Code". */
/*N0GF* /*J0VJ*/ tmp_type = lngd_translation + {&pppirp01_p_2}. */
/*N0GF*/ tmp_type = lngd_translation + "/" + getTermLabel("ANALYSIS_CODE",13).

         substring(part_type, 25 - length(tmp_type), length(tmp_type)) =
            tmp_type.
/*J0VJ*/ /* substring(part_type, 25, 1) = ":". */
/*J0VJ*/ part_code:label in frame a = trim(part_type).


         /*===begin================================================*/
/*K0V6*/ {wbrp01.i}

         
/*GUI mainloop removed */

         
/*GUI*/ {mfguirpa.i true  "printer" 132 }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:


/*J0VJ*/ /* /*J07H*/       display pics_type part_type with frame a.  */

            if plist1     = hi_char then plist1     = "".
            if pics_code1 = hi_char then pics_code1 = "".
            if part_code1 = hi_char then part_code1 = "".
            if curr1      = hi_char then curr1      = "".



/*K0V6*/    if c-application-mode <> 'web':u then
               
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


/*K0V6*/    {wbrp06.i &command = update &fields = "  plist plist1 pics_code
pics_code1 part_code part_code1 curr curr1 effective" &frm = "a"}

/*K0V6*/    if (c-application-mode <> 'web':u) or
/*K0V6*/    (c-application-mode = 'web':u and
/*K0V6*/    (c-web-request begins 'data':u)) then do:


               bcdparm = "".
               {mfquoter.i plist      }
               {mfquoter.i plist1     }
               {mfquoter.i pics_code  }
               {mfquoter.i pics_code1 }
               {mfquoter.i part_code  }
               {mfquoter.i part_code1 }
               {mfquoter.i curr      }
               {mfquoter.i curr1     }
               {mfquoter.i effective }

               if plist1     = "" then plist1     = hi_char.
               if part_code1 = "" then part_code1 = hi_char.
               if pics_code1 = "" then pics_code1 = hi_char.
               if curr1      = "" then curr1      = hi_char.


/*K0V6*/    end.

            
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i  "printer" 132}
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:

    {hksimsg.i """" """"}  /* glx 2004/4/12 add */

find first lngd_det where lngd_dataset = "an_mstr"
                       and lngd_field   = "an_type"
                       and lngd_lang    = global_user_lang
                       and lngd_key1    = pics_type_key
                     no-lock.
find first lngd_det where lngd_dataset = "an_mstr"
                       and lngd_field   = "an_type"
                       and lngd_lang    = global_user_lang
                       and lngd_key1    = part_type_key
                     no-lock.



            {mfphead.i }

            for each pi_mstr
            where (pi_list >= plist and pi_list <= plist1)
            and ((pi_cs_code >= pics_code and pi_cs_code <= pics_code1)
            or  (pics_code = "" and pi_cs_code begins "qadall"))
            and (pi_cs_type = pics_type_key)
            and (pi_part_type = part_type_key)
            and ((pi_part_code >= part_code
            and  pi_part_code <= part_code1)
                    or  (part_code = "" and pi_part_code begins "qadall"))
            and (pi_curr >= curr and pi_curr <= curr1)
            AND LOOKUP(pi_user1,GLOBAL_user_site) > 0   /*glx 20040412 add */
            and (((pi_start <= effective  or pi_start = ?)
            and (pi_expire >= effective or pi_expire = ?))
            or effective = ?) use-index pi_list
            no-lock with frame a:


               /* Interpret type codes */
               find first lngd_det where lngd_dataset = "pi_mstr"
                     and lngd_field   = "pi_amt_type"
                     and lngd_lang    = global_user_lang
                     and lngd_key1    = pi_amt_type
                   no-lock no-error.

               if available lngd_det then
                  amt_type = lngd_translation.
               else
                  amt_type = "".

               find first lngd_det where lngd_dataset = "pi_mstr"
                     and lngd_field   = "pi_qty_type"
                     and lngd_lang    = global_user_lang
                     and lngd_key1    = pi_qty_type
                  no-lock no-error.

               if available lngd_det then
                  qty_type = lngd_translation.
               else
                  qty_type = "".

               find first lngd_det where lngd_dataset = "pi_mstr"
                     and lngd_field   = "pi_comb_type"
                     and lngd_lang    = global_user_lang
                     and lngd_key1    = pi_comb_type
                  no-lock no-error.

               if available lngd_det then
                  comb_type = lngd_translation.
               else
                  comb_type = "".

               display
                  pi_list
                  pi_desc
                  pi_cs_code  when (pi_cs_code <> all_token)
                  "" when (pi_cs_code = all_token) @ pi_cs_code
                  pi_part_code when (pi_part_code <> all_token)
                  "" when (pi_part_code = all_token) @ pi_part_code
                  pi_curr
                  pi_um
                  pi_start
                  pi_expire
                  amt_type
               with frame b STREAM-IO /*GUI*/ .

               display
                  comb_type
                  pi_min_net
                  pi_break_cat
                  pi_confg_disc
                  pi_cost_set
/*J1XZ**          pi_max_ord   */
/*J1XZ*/          pi_max_ord @ pi_disc_seq
                  pi_disc_acct
/*N014*/          pi_disc_sub
                  pi_disc_cc
                  pi_disc_proj with frame c down STREAM-IO /*GUI*/ .

               down with frame c.

               display
                  qty_type @ comb_type
                  pi_max_qty  @ pi_min_net
                  pi_manual   @ pi_confg_disc
                  pi_print    @ pi_cost_set
/*J1XZ**          pi_disc_seq @ pi_max_ord */
/*J1XZ*/          pi_disc_seq
                  pi_accr_acct @ pi_disc_acct
/*N014*/          pi_accr_sub  @ pi_disc_sub
                  pi_accr_cc   @ pi_disc_cc
                  pi_accr_proj @ pi_disc_proj
               with frame c down STREAM-IO /*GUI*/ .

               down 1 with frame c.


               /* display the detail files */
               pirecno = recid(pi_mstr).
               part_frame_row = frame-row(a) + 4.
               {gprun.i ""pppirp1a.p""}.
               
/*GUI*/ {mfguirex.i } /*Replace mfrpexit*/

            end.  /* FOR EACH PI_MSTR */
            
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

          end.  /* mainloop */

/*K0V6*/ {wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" plist plist1 pics_code pics_code1 part_code part_code1 curr curr1 effective "} /*Drive the Report*/
